<template>
	<view class="bigBox">
		<u-navbar :fixed="true" :placeholder="true" :title="pointName" @leftClick="leftClick" bgColor="#0F53AC"
			leftIconColor="#fff">
		</u-navbar>
		<view class="title">{{content}}</view>
		<view class="line8"></view>
		<view class="kiss-list">
			<view class="kiss-list-title">
				<view class="left" style="color: #4D4D4D;">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					隐患判断
				</view>
				<view class="right1">
					<u-radio-group v-model="dataForm.dangerFlag" placement="row" :disabled="isInspec!=0">
						<u-radio :label="'无隐患'" :name="0" activeColor="#0F53AC"
							:labelColor="dataForm.dangerFlag==0 ? '#0F53AC':''">
						</u-radio>
						<u-radio :customStyle="{marginLeft: '80rpx'}" :label="'有隐患'" :name="1" activeColor="#0F53AC"
							:labelColor="dataForm.dangerFlag==1 ? '#0F53AC':''">
						</u-radio>
					</u-radio-group>
				</view>
			</view>
		</view>
		<template v-if="dataForm.dangerFlag == 1">
			<view class="kiss-upDown-list">
				<view class="bx-list-title">
					<view class="left">
						<view style="color: red;" v-if="isInspec == 0">*</view>
						隐患等级
					</view>
				</view>
				<view class="bx-list-title" style="margin-top: 24rpx;">
					<u-radio-group v-model="dataForm.dangerLevel" placement="row">
						<u-radio :label="'一般隐患'" :name="1" activeColor="#0F53AC"
							:labelColor="dataForm.dangerLevel==1 ? '#0F53AC':''">
						</u-radio>
						<u-radio :customStyle="{marginLeft: '100rpx'}" :label="'重大隐患'" :name="2" activeColor="#0F53AC"
							:labelColor="dataForm.dangerLevel==2 ? '#0F53AC':''">
						</u-radio>
					</u-radio-group>
				</view>
			</view>
			<view class="kiss-list">
				<view class="kiss-list-title2" style="padding: 24rpx 32rpx;">
					<view class="left">
						<view style="color: red;" v-if="isInspec == 0">*</view>
						隐患位置
					</view>
					<view class="right1" v-if="isInspec == 0" @click="handleUnit()">
						<view class="iconfont icon-app-add sm-sd">请选择</view>
					</view>
				</view>
				<view class="kiss-list-input" v-if="isInspec == 0">
					<view class="my-input">
						<u-input border="surround" cursorSpacing="60" placeholder="请输入隐患位置"
							v-model="dataForm.dangerSite" inputAlign="left" maxlength="32">
							<template slot="suffix">
								<div class="myLength">{{dangerSiteLength}}/32</div>
							</template>
						</u-input>
					</view>

				</view>
				<view class="textInput" style="padding:0 32rpx;color: #8c8c8c;" v-else>{{dataForm.dangerSite || '无'}}
				</view>
			</view>
		</template>
		<view class="kiss-title">
			<view class="left" style="color: #4D4D4D;">
				<view style="color: red;" v-if="isInspec == 0 &&dataForm.dangerFlag != 0">*</view>
				{{ dataForm.dangerFlag == 0?'巡查':'隐患'}}照片<view v-if="isInspec == 0" style="color: #8c8c8c;">(可传3张)
				</view>
			</view>
		</view>
		<view class="kiss-upload" style="padding: 0 32rpx 32rpx 32rpx;">
			<view v-if="isInspec == 1">
				<view class="textInput" v-if="fileList1.length == 0">暂无记录照片</view>
				<view class="imgBox" v-else>
					<view class="img" v-for="v in imgList">
						<image @tap="previewImage(v,imgList)" :src="v"></image>
					</view>
					<video class="video" v-for="v in videoList" :src="v"></video>
				</view>
			</view>
			<uploadVideo v-else :fileMaxNum="3" @getdata="getdata" :fileType="24" @delete="deletePicture" :file="file">
			</uploadVideo>
		</view>
		<view class="kiss-upDown-list" v-if="dataForm.dangerFlag == 0">
			<view class="bx-list-title">
				<view class="left">
					备注信息
				</view>
			</view>
			<view class="input-textrea" v-if="isInspec == 0">
				<u--textarea class="textrea" cursorSpacing="60" count v-model="dataForm.remark" placeholder="请输入备注信息"
					maxlength="360">
				</u--textarea>
			</view>
			<view class="textInput" v-else>{{dataForm.remark || '无'}}</view>
		</view>
		<template v-if="dataForm.dangerFlag==1">
			<view class="kiss-upDown-list">
				<view class="bx-list-title">
					<view class="left">
						<view style="color: red;" v-if="isInspec == 0">*</view>
						隐患描述
					</view>
				</view>
				<view class="input-textrea" v-if="isInspec == 0">
					<u--textarea class="textrea" cursorSpacing="60" count v-model="dataForm.dangerDesc"
						placeholder="请输入隐患描述" maxlength="360">
					</u--textarea>
				</view>
				<view class="textInput" v-else>{{dataForm.dangerDesc || '无'}}</view>
			</view>

			<view class="kiss-list">
				<view class="kiss-list-title" @click="showReason = true">
					<view class="left">
						隐患形成原因
					</view>
					<view class="right1" v-if="isInspec == 0">
						<view :class="[dataForm.dangerReason != '' ? 'select-bg' : 'sel']">
							{{ dataForm.dangerReason != '' ? dangerReasonData[dataForm.dangerReason - 1] : "请选择" }}
						</view>
						<u-icon name="arrow-right"></u-icon>
					</view>
					<view class="right1" v-else>
						<view :class="[dataForm.dangerReason != '' ? 'select-bg' : '']">
							{{ dataForm.dangerReason != '' ? dangerReasonData[dataForm.dangerReason - 1] : '无' }}
						</view>
					</view>
				</view>
			</view>
			<view class="kiss-upDown-list">
				<view class="bx-list-title">
					<view class="left">
						整改意见
					</view>
				</view>
				<view class="input-textrea" v-if="isInspec == 0">
					<u--textarea class="textrea" cursorSpacing="60" count v-model="dataForm.suggestion"
						placeholder="请输入整改意见" maxlength="360">
					</u--textarea>
				</view>
				<view class="textInput" v-else>{{dataForm.suggestion || '无'}}</view>
			</view>
			<view class="kiss-upDown-list" v-if="!isRiks">
				<view class="bx-list-title">
					<view class="left">
						法律法规
					</view>
				</view>
				<view class="textInput">{{rule}}</view>
			</view>
		</template>

		<u-gap height="6" bgColor="#f2f2f2" v-if="dataForm.dangerFlag==1"></u-gap>
		<view class="kiss-list" v-if="dataForm.dangerFlag==1">
			<view class="kiss-list-title" @click="handleUser">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					整改人
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view :class="[dataForm.realRectify != '' ? 'select-bg' : 'sel']">
						{{ dataForm.realRectify != '' ? dataForm.realRectify : "请选择" }}
					</view>
					<view class="iconfont icon-app-xiangyou" style="color: #8c8c8c;"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[dataForm.realRectify != '' ? 'select-bg' : '']">
						{{ dataForm.realRectify != '' ? dataForm.realRectify : '无' }}
					</view>
				</view>
			</view>
			<view class="kiss-list-title" @click="showTime = true">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					整改时限
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view :class="[dataForm.limitDate != '' ? 'select-bg' : 'sel']">
						{{ dataForm.limitDate != '' ? dataForm.limitDate : "请选择" }}
					</view>
					<view class="iconfont icon-app-xiangyou" style="color: #8c8c8c;"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[dataForm.limitDate != '' ? 'select-bg' : '']">
						{{ dataForm.limitDate != '' ? dataForm.limitDate : '无' }}
					</view>
				</view>
			</view>
		</view>
		<u-gap height="6" bgColor="#f2f2f2" v-if="dataForm.dangerFlag==1"></u-gap>
		<!-- <view class="kiss-list" v-if="dataForm.dangerFlag==1">
			<view class="kiss-list-title">
				<view class="left">
					隐患公示
				</view>
				<view class="right1">
					<u-switch v-model="dataForm.publicityFlag" @change="onChangeGongshi"></u-switch>
				</view>
			</view>
			<view class="kiss-list-title" v-if="dataForm.publicityFlag" @click="handlePublicity">
				<view class="left">
					<view style="color: red;">*</view>
					公示部门
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view :class="[dataForm.publicityDeptNames != '' ? 'select-bg' : 'sel']">
						{{ dataForm.publicityDeptNames != '' ? dataForm.publicityDeptNames : "请选择" }}
					</view>
					<view class="iconfont icon-app-xiangyou"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[dataForm.publicityDeptNames != '' ? 'select-bg' : '']">
						{{ dataForm.publicityDeptNames != '' ? dataForm.publicityDeptNames : '无' }}
					</view>
				</view>
			</view>
			<view class="kiss-list-title" v-if="dataForm.publicityFlag">
				<view class="left">
					发送短信通知
				</view>
				<view class="right1">
					<u-switch v-model="dataForm.sendSmsFlag" @change="onChangesendSmsFlag"></u-switch>
				</view>
			</view>
		</view> -->
		<!-- 底部按钮 -->
		<view class="xing-subside"></view>
		<view class="xing-bottom" v-if="isInspec==0">
			<view class="btn-right" @click="$dianji(sumbit,'onoff')">提交</view>
		</view>


		<u-datetime-picker :disabled="isInspec != 0" :minDate="value4" :show="showTime" :value="value4" mode="date"
			@cancel="cancelTime" @confirm="confirmTime">
		</u-datetime-picker>

		<!-- 隐患形成原因 -->
		<u-picker :show="showReason" :columns="reasonColumns" keyName="name" @confirm="onChangeReason"
			@cancel="cancelReason">
		</u-picker>

		<tki-tree ref="tkitree" :range="treeList" rangeKey="configValue" idKey="id" :selectParent="true"
			confirmColor="#0F53AC" @confirm="confirmTree" />

		<u-overlay :show="tipShow" mode="center" round="6">
			<view class="tip_box">
				<view class="title1">
					提示
				</view>
				<view class="top">
					<text>当前未配置区域，请手动输入</text>
				</view>
				<view class="btn">
					<view class="cacel_btn" @click="tipShow = false">
						知道了
					</view>
				</view>
			</view>
		</u-overlay>
	</view>
</template>

<script>
	import uploadVideo from '@/components/uploadVideo/index.vue';
	import tkiTree from "../components/tki-tree/tki-tree.vue"
	export default {
		components: {
			uploadVideo,
			tkiTree
		},
		data() {
			return {
				tipShow: false,
				imgList: [],
				videoList: [],
				treeList: [],
				content: '', //检查内容
				isInspec: 0, // 0 编辑 1 查看详情
				showBumen: false,
				showGongshiBumen: false,
				showTime: false,
				value4: Number(new Date()),
				indicatorStyle: `height: ${Math.round(uni.getSystemInfoSync().screenWidth/(750/100))}px;`,
				valueArr: [0, 0], // 用于判断当前滑动的是哪一列
				province: [], // 数据列表
				dataForm: {
					dangerFlag: 0, //有无隐患 0.无隐患  1.有隐患
					dangerLevel: '', //隐患等级 1.一般隐患；2.重大隐患；
					dangerPhoto: '', //照片
					dangerSite: '', //隐患位置
					dangerDesc: '', //隐患描述
					suggestion: '', //整改意见
					rectifyDeptId: '',
					rectifyDeptName: '', //整改部门
					rectifyUid: "",
					rectifyName: "", //整改人姓名
					dangerReason: '',
					realRectify: '',
					limitDate: '', //整改时限
					remark: '',
					deptIds: '', //公示部门
					publicityFlag: false, // 隐患是否公示；0.否；1.是;
					publicityDeptIds: '', //公式部门id
					publicityDeptNames: '', //公式部门名称
					sendSmsFlag: false //是否发送短信；0.否；1.是；
				},
				userColumns: [],
				rules: {
					'name': {
						type: 'string',
						required: true,
						message: '请填写姓名',
						trigger: ['blur', 'change']
					},
				},
				radio: '',
				switchVal: false,
				onoff: true,
				fileList1: [],
				sourceType: ['album', 'camera'],
				pictrueList: [],
				ruleId: '', // 检查内容id
				inspectionId: '', // 巡查任务id
				regionName: '',
				dangerId: '', //隐患id
				rule: '', //法律法规
				planName: '',
				openValue: '',
				saveParams: {
					pictures: '',
				},
				file: '',
				// 区分是风险点还是安全巡查
				isRiks: false,
				pointName: '隐患判断',
				showReason: false,
				dangerReasonData: ['人的不安全行为', '物的不安全状态', '管理缺陷', '环境与场所', '其他'],
				reasonColumns: [
					[{
							id: 1,
							name: '人的不安全行为'
						},
						{
							id: 2,
							name: '物的不安全状态'
						},
						{
							id: 3,
							name: '管理缺陷'
						},
						{
							id: 4,
							name: '环境与场所'
						},
						{
							id: 5,
							name: '其他'
						},
					]
				],
				htInfo: {},
				planName: '',
				unitName: '',
				dangerSiteLength: 0
			};
		},
		watch: {
			'dataForm.dangerSite'(val) {
				this.dangerSiteLength = val.length
			},
		},
		onShow() {

		},
		onLoad(options) {
			if (options) {
				if (options.remark != '') {
					this.isInspec = 1
				}
				if (options.isRiks) {
					// 风险点
					this.isRiks = options.isRiks
					this.pointName = options.pointName
					this.unitName = options.unitName
					this.dataForm.dangerSite = options.unitName
					this.content = options.content
					this.ruleId = options.ruleId
					this.inspectionId = options.inspectionId
					this.rule = options.rule || '无'
					this.dangerId = options.dangerId // 隐患id
					this.regionName = options.regionName
				} else {
					// 安全巡查
					this.content = options.content
					this.ruleId = options.ruleId
					this.inspectionId = options.inspectionId
					this.dangerId = options.dangerId // 隐患id
					this.dataForm.dangerSite = options.regionName //默认隐患位置
					this.dataForm.suggestion = options.suggestion //默认整改意见
					this.rule = options.rule || '无'
					this.planName = options.planName
					this.openValue = options.openValue
					this.regionName = options.regionName
				}

			}

			if (this.dangerId) this.initData()
			// 部门树数据
			this.getRegionData('')
			this.getBumenData()
			// 公式部门选择回调
			uni.$on('setBumenList', (data) => {
				console.log(data)
				let idArr = []
				let nameArr = []
				data.forEach(item => {
					idArr.push(item.id)
					nameArr.push(item.deptName)
				})
				this.dataForm.publicityDeptIds = idArr.join(',')
				this.dataForm.publicityDeptNames = nameArr.join(',')
			})
			// 整改人员选择回调
			uni.$on('setUser', (data) => {
				this.dataForm.rectifyDeptId = data.parentId
				this.dataForm.rectifyDeptName = data.deptName
				this.dataForm.rectifyUid = data.id
				this.dataForm.rectifyName = data.name
				this.dataForm.realRectify = data.deptName + '-' + data.name
			})
			// 单元选择回调
			uni.$on('setUnit', (data) => {
				this.dataForm.dangerSite = data.configValue
			})
		},
		onUnload() {
			var pages = getCurrentPages(); //当前页面栈
			if (pages.length > 1) {
				var beforePage = pages[pages.length - 2]; //获取上一个页面实例对象
				beforePage.data.needGetData = true;
			}
		},
		methods: {
			getRegionData(k) {
				let params = {
					configType: 'risk_unit',
					keyword: k
				}
				uni.$u.http.post(`/check/pc/riskPoint/getRiskUnit`, params).then(res => {
					if (res.code == 0) {
						this.treeList = res.data
						console.log(this.treeList);
					}
				})
			},
			confirmTree(e) {
				console.log(e);
				if (e[0]) {
					this.dataForm.dangerSite = e[0].configValue
				}
			},
			//选择隐患位置
			toRegion() {
				if (this.treeList.length != 0) {
					this.$refs.tkitree._show()
				} else {
					this.tipShow = true
				}
				// this.tipShow = true
			},
			//选择隐患位置
			handleUnit() {
				if (this.treeList.length != 0) {
					uni.navigateTo({
						url: `/pages/subPackagesA/riskIdtion/unitTree`
					})
				} else {
					this.tipShow = true
				}
				
			},
			leftClick() {
				this.handleBack()
			},
			initData() {
				uni.$u.http.get(`/check/mobile/appDangerInfo/getDangerDetail/${this.dangerId}`).then(res => {
					if (res.code == 0) {
						this.dataForm = res.data
						this.dataForm.sendSmsFlag = res.data.sendSmsFlag ? true : false
						this.dataForm.publicityFlag = res.data.publicityFlag ? true : false
						this.saveParams.pictures = res.data.dangerPhoto;
						// 图片回显
						this.file = res.data.dangerPhoto
						if (res.data.dangerPhoto != '') {
							// 图片回显
							let arr = []
							res.data.dangerPhoto.split(',').map(item => {
								let dd = {
									url: item
								}
								arr.push(dd);
							})
							this.fileList1 = arr
							this.fileList1.forEach(item => {
								let str = item.url.split('?')[0]
								if (str.substring(str.length - 3, str.length) == 'mp4') {
									this.videoList.push(item.url)
								} else {
									this.imgList.push(item.url)
								}
							})
						} else {
							this.fileList1 = []
						}
						this.htInfo = JSON.parse(JSON.stringify(this.dataForm))
					}
				}).catch(err => {})
			},
			getBumenData() {

				uni.$u.http.get(`/base/mobile/sysDeptInfo/deptTreeList`).then(res => {
					if (res.code == 0) {
						this.province = res.data
					}
				}).catch(err => {})
			},
			//这里写个方法便于判断当前列表信息是否未保存
			judge: function() {
				let obj = this.dataForm
				let type = false
				console.log(obj)
				//1.先判断是否有id
				if (obj.id) {
					//判断是否与之前的值一致不一致提示保存
					let oldObj = this.htInfo
					obj.dangerPhoto = this.saveParams.pictures
					//判断两个obj是否相同
					for (let key in obj) {
						if (obj[key] != oldObj[key]) {
							type = true
						}
					}
				} else {

					for (let key in obj) {
						if (obj[key]) {
							type = true
						}
					}
				}
				return type
			},
			//返回按钮
			handleBack: async function() {
				const that = this
				const type = await this.judge()
				//这里要判断几个逻辑 1.添加未保存（提示） 2.查看已修改（提示） 3.查看未修改（不提示直接返回）
				if (type) {
					uni.showModal({
						title: '提示',
						// 提示文字
						content: '当前隐患信息未保存，确定返回？',
						// 取消按钮的文字自定义
						cancelText: "取消",
						// 确认按钮的文字自定义
						confirmText: "确定",
						//取消字体的颜色
						cancelColor: '#000000',
						success: function(res) {
							if (res.confirm) {
								// var pages = getCurrentPages(); //当前页面栈
								// if (pages.length > 1) {
								// 	var beforePage = pages[pages.length - 2]; //获取上一个页面实例对象
								// 	beforePage.$vm.dataForm.forEach(it => {
								// 		it.children.forEach(item => {
								// 			if (item.id == this.ruleId) {
								// 				item.dangerNum = that.htLists.length
								// 			}
								// 		})
								// 	})
								// 	beforePage.data.refreshIfNeeded = true;
								// }
								uni.navigateBack({
									delta: 1
								})
							} else {
								// 执行取消后的操作
							}
						}
					})
				} else {
					// var pages = getCurrentPages(); //当前页面栈
					// if (pages.length > 1) {
					// 	var beforePage = pages[pages.length - 2]; //获取上一个页面实例对象
					// 	beforePage.$vm.dataForm.forEach(it => {
					// 		it.children.forEach(item => {
					// 			if (item.id == this.ruleId) {
					// 				item.dangerNum = that.htLists.length
					// 			}
					// 		})
					// 	})
					// 	beforePage.data.refreshIfNeeded = true;
					// }
					//返回上一页面
					uni.navigateBack({
						delta: 1
					})

				}
			},
			sumbit() {
				let params = {
					ruleId: this.ruleId,
					inspectionId: this.inspectionId,
					dangerFlag: this.dataForm.dangerFlag,
					dangerPhoto: this.saveParams.pictures,
					dangerType: this.isRiks ? 2 : 1, // 1.企业自查隐患; 2.风险管控隐患
				}

				if (this.dangerId) {
					params.id = this.dangerId
				}
				if (this.dataForm.dangerFlag == 0) {
					// 无隐患
					params.remark = this.dataForm.remark
				} else {
					if (this.dataForm.dangerLevel == '') {
						uni.$u.toast('请选择隐患等级')
						return
					}
					if (this.dataForm.dangerSite == '') {
						uni.$u.toast('请填写隐患位置')
						return
					}
					if (this.saveParams.pictures == '') {
						uni.$u.toast('请添加隐患照片')
						return
					}
					if (this.dataForm.dangerDesc == '') {
						uni.$u.toast('请填写隐患描述')
						return
					}
					if (this.dataForm.rectifyUid == '') {
						uni.$u.toast('请选择整改人')
						return
					}
					if (this.dataForm.limitDate == '') {
						uni.$u.toast('请选择整改时限')
						return
					}
					if (this.dataForm.publicityFlag && this.dataForm.publicityDeptIds == '') {
						uni.$u.toast('请选择公示部门')
						return
					}
					// 有隐患
					params.dangerLevel = this.dataForm.dangerLevel
					params.dangerSite = this.dataForm.dangerSite //隐患位置
					params.dangerDesc = this.dataForm.dangerDesc //隐患描述
					params.suggestion = this.dataForm.suggestion //整改意见
					params.rectifyDeptId = this.dataForm.rectifyDeptId
					params.rectifyDeptName = this.dataForm.rectifyDeptName
					params.rectifyUid = this.dataForm.rectifyUid
					params.rectifyName = this.dataForm.rectifyName //整改人姓名
					params.dangerReason = this.dataForm.dangerReason //隐患形成原因
					params.limitDate = this.dataForm.limitDate //整改时限
					params.publicityFlag = this.dataForm.publicityFlag ? 1 : 0 //短信通知
					params.publicityDeptIds = this.dataForm.publicityDeptIds //公示部门id
					params.publicityDeptNames = this.dataForm.publicityDeptNames //公示部门name
					params.sendSmsFlag = this.dataForm.sendSmsFlag ? 1 : 0 //短信通知

				}

				uni.$u.http.post(`/check/mobile/appDangerInfo/addDangerInfo`, params).then(res => {
					if (res.code == 0) {
						uni.$u.toast('提交成功')
						if (!this.isRiks) {
							let pages = getCurrentPages(); //获取所有页面栈实例列表
							let nowPage = pages[pages.length - 1]; //当前页页面实例
							let prevPage = pages[pages.length - 2]; //上一页页面实例
							prevPage.$vm.openValue = this.openValue;
							prevPage.$vm.inspectionId = this.inspectionId;
							prevPage.$vm.planName = this.planName;
						}

						if (this.dataForm.dangerFlag == 0) {
							uni.navigateBack({ //uni.navigateTo跳转的返回，默认1为返回上一级
								delta: 1
							});
						} else {
							uni.navigateTo({
								// isRiks=${true}&pointName=${this.pointName}&unitName=${this.unitName}&isInspec=${0}
								url: `/pages/subPackagesA/troble/multipleTroble?ruleId=${this.ruleId}&isRiks=${this.isRiks}&isInspec=${0}&inspectionId=${this.inspectionId}&rule=${this.rule}&content=${this.content}&isShow=${true}&isLook=${0}&regionName=${this.regionName}&type=${1}&planName=${this.planName}&pointName=${this.pointName}&unitName=${this.unitName}`
							})
						}
					}
				}).catch(err => {})
			},
			getdata(e) {
				this.pictrueList = e;
				this.fileList1 = [];
				if (this.pictrueList.length > 0) {
					this.saveParams.pictures = "";
					let arry = []
					this.pictrueList.map(item => {
						arry.push(item)
						let dd = {
							url: item
						}
						this.fileList1.push(dd);
					})
					this.saveParams.pictures = arry.toString()
				}
			},
			deletePicture(e) {
				this.fileList1 = [];
				this.saveParams.pictures = "";
				if (e.length > 0) {
					let arry = []
					e.map(item => {
						arry.push(item)
						let dd = {
							url: item
						}
						this.fileList1.push(dd);
					})
					this.saveParams.pictures = arry.toString()
				}
			},

			onChangeGongshi(e) {
				this.dataForm.publicityFlag = e
			},
			onChangesendSmsFlag(e) {
				this.dataForm.sendSmsFlag = e
			},
			cancelTime(e) {
				this.showTime = false;
			},
			confirmTime(e) {
				this.showTime = false;
				const timeFormat = uni.$u.timeFormat;
				let timeValue = timeFormat(e.value, 'yyyy-mm-dd');
				this.dataForm.limitDate = timeValue;
			},
			handleUser() {
				uni.navigateTo({
					url: `/pages/subPackagesA/riskIdtion/userTree`
				})
			},
			handlePublicity() {
				uni.navigateTo({
					url: `/pages/subPackagesA/troble/bumenSelect?selectIds=${this.dataForm.publicityDeptIds}`
				})
			},
			onChangeReason(e) {
				this.dataForm.dangerReason = e.value[0].id
				this.showReason = false
			},
			cancelReason() {
				this.showReason = false
			},
			//预览图片
			previewImage: function(e, s) {
				let imgList = []
				if (s.pictures) {
					imgList = this.getpictureList(s.pictures)
				} else {
					imgList = s
				}
				uni.previewImage({
					current: e,
					urls: imgList,
				});
			},
			//处理图片
			getpictureList(pictureinfo) {
				if (pictureinfo) {
					var splitAdd = pictureinfo.split(",");
					var imgList = []
					for (let i = 0; i < splitAdd.length; i++) {
						let iOrV = splitAdd[i].split("?")[0].split(".")
						let iOrVL = splitAdd[i].split("?")[0].split(".").length - 1
						if (iOrV[iOrVL] != 'mp4') {
							imgList.push(splitAdd[i])
						}
					}
					return imgList
				} else {
					return []
				}
			}
		},
	}
</script>

<style scoped lang="scss">
	.my-input {
		border-bottom: 1px solid #F5F5F5;

		/deep/ .u-input {
			background-color: #f2f2f2 !important;
		}

		.myLength {
			color: #909193;
			font-size: 12px;
			padding: 1px 4px;
		}
	}

	.bigBox {

		.title {
			padding: 32rpx;
			margin-right: 16rpx;
			word-break: break-all;
			word-wrap: break-word;
			min-height: 42rpx;
		}

		.box {
			padding: 0 20rpx;
		}

		.bx-upload {
			padding: 20rpx 30rpx;
			background: #fff;
			border-bottom: 1px solid #d6d7d9;
		}

		.bottom-subside {
			width: 100%;
			height: 120rpx;
		}

		.bx-bottom {
			width: 100%;
			background: #ffffff;
			display: flex;
			justify-content: space-around;
			align-items: center;
			padding: 20rpx 0;
			position: fixed;
			z-index: 9;
			bottom: 0;

			.btn-right {
				width: 80%;
				height: 92rpx;
				border-radius: 12rpx;
				background: #0F53AC;
				display: flex;
				justify-content: center;
				align-items: center;
				color: #fff;
				font-size: 34rpx;
				font-weight: 500;
				letter-spacing: 0px;
				line-height: 0px;
			}
		}

	}

	.imgBox {
		display: flex;

		.img {
			width: 27vw;
			height: 27vw;
			margin-bottom: 4vw;
			margin-right: 4vw;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.video {
			width: 27vw;
			height: 27vw;
			margin-bottom: 4vw;
			margin-right: 4vw;
		}
	}

	.sel {
		color: #8C8C8C;
	}

	.tip_box {
		width: 560rpx;
		padding-top: 64rpx;
		background-color: #fff;
		border-radius: 12rpx;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);

		.title1 {
			text-align: center;
			margin-bottom: 32rpx;
			font-size: 32rpx;
			font-weight: 500;
		}

		.top {
			font-size: 16px;
			font-weight: 400;
			padding-bottom: 64rpx;
			color: #4D4D4D;
			text-align: center;
			border-bottom: 2rpx solid #e5e5e5;
		}

		.btn {
			display: flex;
			justify-content: center;
			align-items: center;

			.cacel_btn {
				text-align: center;
				font-size: 34rpx;
				font-weight: 500;
				color: #0F53AC;
				width: 50%;
				height: 112rpx;
				line-height: 112rpx;
			}

		}
	}
</style>
